package com.lzx.lizhenxing.user.comtroller;

import com.lzx.lizhenxing.common.vo.CommonResult;
import com.lzx.lizhenxing.user.param.ExpressDeAddParam;
import com.lzx.lizhenxing.user.param.ExpressDePageQueryParam;
import com.lzx.lizhenxing.user.service.UserExpressDeliveryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user/express")
public class UserExpressDeliveryController {

    @Resource
    private UserExpressDeliveryService userExpressDeliveryService;

    @PostMapping("/getPageExpressDelivery")
    public CommonResult getPageExpressDelivery(@RequestBody ExpressDePageQueryParam param){
        return CommonResult.success(userExpressDeliveryService.queryByPage(param));
    }

    @PostMapping("/deleteExDeBatch")
    public CommonResult deleteExDeBatch(@RequestBody List<Long> ids){
        userExpressDeliveryService.deleteExDeBatch(ids);
        return CommonResult.success();
    }

    @PostMapping("/addExDe")
    public CommonResult addExDe(@RequestBody ExpressDeAddParam param){
        userExpressDeliveryService.addExDe(param);
        return CommonResult.success();
    }

    @GetMapping("/deleteOneExDe")
    public CommonResult deleteOneExDe(@RequestParam Long id){
        userExpressDeliveryService.deleteOneExDe(id);
        return CommonResult.success();
    }
}
